var userAgent = navigator.userAgent, 
				rMsie = /(msie\s|trident.*rv:)([\w.]+)/, 
				rFirefox = /(firefox)\/([\w.]+)/, 
				rOpera = /(opera).+version\/([\w.]+)/, 
				rChrome = /(chrome)\/([\w.]+)/, 
				rSafari = /version\/([\w.]+).*(safari)/;
				var browser;
				var version;
				var ua = userAgent.toLowerCase();
				function uaMatch(ua) {
					var match = rMsie.exec(ua);
					if (match != null) {
						return { browser : "IE", version : match[2] || "0" };
					}
					var match = rFirefox.exec(ua);
					if (match != null) {
						return { browser : match[1] || "", version : match[2] || "0" };
					}
					var match = rOpera.exec(ua);
					if (match != null) {
						return { browser : match[1] || "", version : match[2] || "0" };
					}
					var match = rChrome.exec(ua);
					if (match != null) {
						return { browser : match[1] || "", version : match[2] || "0" };
					}
					var match = rSafari.exec(ua);
					if (match != null) {
						return { browser : match[2] || "", version : match[1] || "0" };
					}
					if (match != null) {
						return { browser : "", version : "0" };
					}
				}
				var browserMatch = uaMatch(userAgent.toLowerCase());
				if (browserMatch.browser) {
					browser = browserMatch.browser;
					version = browserMatch.version;
				}

				
				
				var str = '';

var copyright='金格科技iWebOffice2015智能文档中间件[演示版];V5.0S0xGAAEAAAAAAAAAEAAAAJ0BAACgAQAALAAAANzjZvtiXLkHJdDk1yYwCJbuXO8SB0AwJLEXm/qj1zPTm5HagGB++cI3C7ixX4DqyEbfP0SRwEuaL9eltQWrbsbZNxYb+NfsDQ6X5WMw2zXvWLdLVcKyFB2/tWtXIQzqCLrbwRxacu/0hdV8YWXLojktERkGXsRbBtmsnHsZ8q6TG4BZnxOchn341MP0dxSvqJAn+OblhAoDKdfioTm9tnsYmhBC2bNdMA1Mhn4yVW8ZaURHZZtoKgzXWDfpFch+CS8xbUwGpcbBIrCiIC2mQ2/Ae1qlfFvrN72AqMtQfd9oGBE1UJNe67VXM24d22SesKAu96bDdknWzMPMOjDjLb1Z/r+qgxCbZClfMRx9pfKTWNDwS6vKP2njTUwBcwD7t5teCzgAbduDyi/2b0p7te795/td9U9V3BueylJMA2BmbtfwXJtB1LDwK3FNO5+osTrKcj3S9b5qgvonYOf8F8TxcPeWESOmQ8CvAQbhCoZdiwdxKvX2nr1B5Dqkni+pSLDmvGqpnBxdpJ6jXruDjry2dO2QHDjvrtlJxIL65OoiDlqHZeCFC+D4gtVgOaOQ/A==';

var copyright_zukk = '金格科技iWebOffice2015智能文档中间件[演示版];V5.0S0xGAAEAAAAAAAAAEAAAAJ0BAACgAQAALAAAANzjZvtiXLkHJdDk1yYwCJbuXO8SB0AwJLEXm/qj1zPTm5HagGB++cI3C7ixX4DqyEbfP0SRwEuaL9eltQWrbsbZNxYb+NfsDQ6X5WMw2zXvWLdLVcKyFB2/tWtXIQzqCLrbwRxacu/0hdV8YWXLojktERkGXsRbBtmsnHsZ8q6TG4BZnxOchn341MP0dxSvqJAn+OblhAoDKdfioTm9tnsYmhBC2bNdMA1Mhn4yVW8ZaURHZZtoKgzXWDfpFch+CS8xbUwGpcbBIrCiIC2mQ2/Ae1qlfFvrN72AqMtQfd9oGBE1UJNe67VXM24d22SesKAu96bDdknWzMPMOjDjLb1Z/r+qgxCbZClfMRx9pfKTWNDwS6vKP2njTUwBcwD7t5teCzgAbduDyi/2b0p7te795/td9U9V3BueylJMA2BmbtfwXJtB1LDwK3FNO5+osTrKcj3S9b5qgvonYOf8F8TxcPeWESOmQ8CvAQbhCoZdiwdxKvX2nr1B5Dqkni+pSLDmvGqpnBxdpJ6jXruDjry2dO2QHDjvrtlJxIL65OoiDlqHZeCFC+D4gtVgOaOQ/A==';

if ((window.ActiveXObject!=undefined) || (window.ActiveXObject!=null) ||"ActiveXObject" in window)
{
	str += '<object id="WebOffice2015" ';
	
	str += ' width="100%"';
	str += ' height="100%"';
	
	//32λ�ؼ�
	if(window.navigator.platform == "Win32") 
		str += ' CLASSID="CLSID:D89F482C-5045-4DB5-8C53-D2C9EE71D025"  codebase="iWebOffice2015.cab#version=0,,0,0"';
	//64λ�ؼ�
	if (window.navigator.platform == "Win64")
		str += ' CLASSID="CLSID:D89F482C-5045-4DB5-8C53-D2C9EE71D024"  codebase="iWebOffice2015.cab#version=12,7,0,826"';
	str += '>';
	str += '<param name="Copyright" value="' + copyright + '">';
}
else if (browser == "chrome") 
{
	str += '<object id="WebOffice2015" ';


	str += ' width="100%"';
	str += ' height="100%"';
	str += ' clsid="CLSID:D89F482C-5045-4DB5-8C53-D2C9EE71D025"';        
	str += ' type="application/kg-plugin"';                              //KGChromePlugin���type
	//str += ' type="application/kg-activex"';                           //iWebPlugin���type
	//str += ' type="application/iwebplugin"';
	str += ' OnCommand="OnCommand"';
	str += ' OnOLECommand="OnOLECommand"';
	str += ' OnReady="OnReady"';
	str += ' OnRightClickedWhenAnnotate="OnRightClickedWhenAnnotate"';
	str += ' OnSending="OnSending"';
	str += ' OnSendEnd="OnSendEnd"';
	str += ' OnRecvStart="OnRecvStart"';
	str += ' OnRecving="OnRecving"';
	str += ' OnRecvEnd="OnRecvEnd"';
	str += ' OnFullSizeBefore="OnFullSizeBefore"';
	str += ' OnFullSizeAfter="OnFullSizeAfter"';
	str += ' OnExitPrintPreview="OnExitPrintPreview"';        //�˳���ӡԤ���¼�
	str += ' Copyright="' + copyright + '"';
	str += '>';
}
else if (browser == "firefox") 
{
	str += '<object id="WebOffice2015" ';
	str += ' width="100%"';
	str += ' height="100%"';
	str += ' clsid="CLSID:D89F482C-5045-4DB5-8C53-D2C9EE71D025"';
	str += ' type="application/kg-activex"';
	//str += ' type="application/iwebplugin"';
	str += ' OnCommand="OnCommand"';
	str += ' OnReady="OnReady"';
	str += ' onUnload="onUnload"';
	str += ' OnOLECommand="OnOLECommand"';
	str += ' OnExecuteScripted="OnExecuteScripted"';
	str += ' OnQuit="OnQuit"';
	str += ' OnSendStart="OnSendStart"';
	str += ' OnSending="OnSending"';
	str += ' OnSendEnd="OnSendEnd"';
	str += ' OnRecvStart="OnRecvStart"';
	str += ' OnRecving="OnRecving"';
	str += ' OnRecvEnd="OnRecvEnd"';
	str += ' OnRightClickedWhenAnnotate="OnRightClickedWhenAnnotate"';
	str += ' OnFullSizeBefore="OnFullSizeBefore"';
	str += ' OnFullSizeAfter="OnFullSizeAfter"';	
	str += ' Copyright="' + copyright + '"';
	str += '>';
}

str += '</object>';
var str_zukk = '<object id="WebOffice" type="application/iweboffice" height="1000px" width="100%" >'
	str_zukk += '<param name="Copyright" value="' + copyright_zukk + '">';
	str_zukk += '</object>';

var OSType = detectOS();
//alert(OSType.indexOf("Win"))

if(OSType.indexOf("Win") > -1)
{
	document.write(str);         //Windows�¼���iWebOffice2015�ؼ�
	//alert(str);
}else{
	//alert(str_zukk);
	document.write(str_zukk);   //Linux�¼���iWebOffice_ZZKK�ؼ�

}

//��ȡ��ǰ����ϵͳ��Windows����Linux
function detectOS() 
	{
		var sUserAgent = navigator.userAgent;
		var isWin = (navigator.platform == "Win32") || (navigator.platform == "Win64")|| (navigator.platform == "Windows");
		var isMac = (navigator.platform == "Mac68K") || (navigator.platform == "MacPPC") || (navigator.platform == "Macintosh") || (navigator.platform == "MacIntel");
		if (isMac) 
			return "Mac";
		var isUnix = (navigator.platform == "X11") && !isWin && !isMac;
		if (isUnix) 
			return "Unix";
		var isLinux = (String(navigator.platform).indexOf("Linux") > -1);
		
		if (isLinux) 
			return "Linux";
		
		if (isWin) 
		{
			return "isWin";
		}
		
		return "other";
	}



